package 测试;

public class 作业测试 {

	public static void main(String[] args) {
		String str = "   java Android   ";
		System.out.println(trim(str));
	}
	public static String trim(String str) {
		int start = 0;
		int end = str.length() - 1;
		while (start <= end && str.charAt(start) == ' ') {
			start++;
		}
		while (start <= end && str.charAt(end) == ' ') {
			end--;
		}
		return str.substring(start, end + 1);
	}
}
